<template>
  <div class="agent-wrap">
    <div class="agent-detail">
      <div class="agent-modular">
        <!-- <h2 class="agent-tit">基本信息</h2> -->
        <div class="agent-modular-items">
          <div class="agent-modular-item" @click="updateTip()">
            <span class="tit">姓名</span>
            <span class="intro">{{ customForm.agentName }}</span>
          </div>
          <!-- <div class="agent-modular-item" @click="updateTip()">
            <span class="tit">推荐码</span>
            <span class="intro">{{
              customForm.userNo ? customForm.userNo : ""
            }}</span>
          </div> -->
          <div class="agent-modular-item" @click="updateTip()">
            <span class="tit">注册时间</span>
            <span class="intro">{{ customForm.addDate }}</span>
          </div>
          <div class="agent-modular-item" @click="updateTip()">
            <span class="tit">手机号码</span>
            <span class="intro">{{ customForm.linkMobile }}</span>
          </div>
        </div>
      </div>
      <!-- <view class="update-btn">
        <u-button
          type="primary"
          shape="circle"
          @click="toUpdate()"
          >修改</u-button
        >
      </view> -->
    </div>
  </div>
</template>

<script>
import { editName, agentInfo, merchInfo } from "_a/myInfo";
export default {
  name: "BaseInfo",
  data() {
    return {
      type: "", //页面类型
      btnIsShow: false,
      customForm: {},
    };
  },
  created() {
    this.customForm = this.$store.getters.user;
  },
  methods: {
    phoneS(customForm) {
      if (customForm.mobile) {
        return (
          customForm.mobile.substring(0, 3) +
          " **** " +
          customForm.mobile.substring(
            customForm.mobile.length - 4,
            customForm.mobile.length
          )
        );
      } else {
        return "";
      }
    },
    agentInfoHandle(agentNo) {
      agentInfo(agentNo).then((res) => {
        if (res.code === 200 && res.data) {
          this.customForm = res.data;
        }
      });
    },
    merchInfoHandle() {
      merchInfo(this.merchno).then((res) => {
        if (res.code === 200 && res.data) {
          this.customForm = res.data;
        }
      });
    },
    updateTip() {
      // if (this.type != "merchant") {
      //   this.$tip.toast("暂不支持修改");
      // }
    },
    toUpdate() {
      if (!this.customForm.agentName) {
        this.$tip.toast("推客名不能为空");
        return false;
      }
      editName({ agentName: this.customForm.agentName }).then((res) => {
        if (res.code === 200) {
          this.$tip.toast("修改成功");
          this.agentInfoHandle();
          this.btnIsShow = false;
          setTimeout(() => {
            this.$nav.push({ path: "home" });
          }, 500);
        }
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.agent-modular{
  margin: R(20);
}
.agent-modular .agent-tit {
  padding: R(20px);
  font-size: R(28px);
  color: #828282;
}

.agent-modular .agent-modular-items {
  padding-left: R(30px);
  background: #fff;
}

.agent-modular .agent-modular-item {
  display: flex;
  min-height: R(100px);
  align-items: center;
  padding: 0 R(20px);
  position: relative;
}

.agent-modular .agent-modular-item:after {
  content: "";
  position: absolute;
  display: block;
  background: #ddd;
  pointer-events: none;
  z-index: 1;
  height: 1px;
  left: 0;
  right: 0;
  bottom: 0;
}

.agent-modular .agent-modular-item:last-child:after {
  display: none;
}

.agent-modular .agent-modular-item span {
  display: block;
}

.agent-modular .agent-modular-item .intro {
  font-size: R(28px);
  color: #7b7b7b;
}

.agent-modular .agent-modular-item .tit {
  flex: 1;
  margin-right: R(20px);
  white-space: nowrap;
}

.agent-modular .agent-modular-item .tit .tips {
  display: block;
  font-size: R(24px);
  color: #999;
}

.update-btn {
  width: R(500px);
  margin: R(150px) auto;
}
</style>
